﻿<%@ Page Title="" Language="C#" MasterPageFile="~/System/MasterPage2.master" AutoEventWireup="true" CodeFile="JM_rand_Ca.aspx.cs" Inherits="Agency_JM_rand_Ca" %>

 <asp:Content ID="Content1" ContentPlaceHolderID="Agency" Runat="Server">

  
    <script type="text/javascript" language="javascript" for="window" event="OnLoad">
		function GetList(strListID) 
		{			
			var strTemp_pnp;
			var strOption;
			var len;
			var strName;
			var strUniqueID;
			var objListID = eval(strListID);
			EnumUsbKey();
			strTemp_pnp =  getUserList_pnp();
			while (1) {
				i=strTemp_pnp.indexOf("&&&");
				if (i <= 0) {
					break;
				}
				strOption = strTemp_pnp.substring(0,i);
				strName = strOption.substring(0, strOption.indexOf("||"));
				strUniqueID = strOption.substring(strOption.indexOf("||") + 2, strOption.length);
				var objItem = new Option(strName,strUniqueID);
				objListID.add(objItem);
				len = strTemp_pnp.length;
				strTemp_pnp = strTemp_pnp.substring(i+3,len);
			}
			var objListID = null;
		}

		GetList("aspnetForm.UserList");
    </script>

    <script type="text/javascript" for="USBKEY" event="OnUSBKeyChange" language="javascript">
		//响应key 插拔动作
		//alert("OnUSBKeyChange");
		function ChangeList(strListID) {
			
			var strTemp_pnp;
			var strOption;
			var len;
			var strName;
			var strUniqueID;
			
			var objListID = eval(strListID);
			
			var i;
			var n = objListID.length;
			for(i=0;i<n;i++)
			{
				objListID.remove(0);
			}
				
			strTemp_pnp =  getUserList_pnp();
			while (1) {
				i=strTemp_pnp.indexOf("&&&");
				if (i <= 0) {
					break;
				}
				strOption = strTemp_pnp.substring(0,i);
				strName = strOption.substring(0, strOption.indexOf("||"));
				strUniqueID = strOption.substring(strOption.indexOf("||") + 2, strOption.length);
				var objItem = new Option(strName,strUniqueID)
				objListID.add(objItem);
				len = strTemp_pnp.length;
			strTemp_pnp = strTemp_pnp.substring(i+3,len);
			}
			var objListID = null;
		}

		ChangeList("aspnetForm.UserList");
    </script>

    <script type="text/javascript" language="javascript">
        var strServerSignedData = "<%=strSignData%>";   //取服务端的签名值
        var strServerRan = "<%=strRan%>";                 //取服务端的随机数  
        function aspnetForm_Submit() {
            //--这里进行您的业务处理--------
            //------------------------------
            aspnetForm.action = "Index.aspx";
            var ret;
            //--安全登录接口--------------------------------
            var strContainerName = aspnetForm.UserList.value;
            var strPin = aspnetForm.UserPwd.value;

            ret = Login(aspnetForm, strContainerName, strPin);
            //---------------------------------------------
            aspnetForm.UserPwd.value = "";
            return ret;
        }
        function InputCheck() {


            var userCert = document.getElementById("UserList");
            var userPass = document.getElementById("UserPwd");

            if (userCert.value == "") {
                alert("请插入用户证书!");
                return false;
            }

            if (userPass.value == "") {
                alert("请输入证书密码!");
                return false;
            }



            //--安全登录接口--------------------------------
            var strContainerName = userCert.value; //用户列表
            var strPin = userPass.value;          //证书密码
            var ret = Login(aspnetForm, strContainerName, strPin); //客户端验证
            if (!ret) {
                return false;
            }
            document.getElementById("ctl00_Agency_hddContainerName").value = strContainerName; //获取容器
            document.getElementById("ctl00_Agency_hddEncCert").value = getEncCert(strContainerName); //加密证书
            //---------------------------------------------
            userPass.value = "";
            return true;
        }
    </script>
    
                    <table width="500px" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td style="width: 100px">
                                用户证书：
                            </td>
                            <td>
                                <select id="UserList" name="userName" style="width: 119px">
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 100px">
                                证书口令：
                                <%--验证码：--%>
                            </td>
                            <td>
                                <input type="password" name="pwd1" id="UserPwd" style="width: 115px;" />
                                <%--<input type="text" name="txtCheckCode" size="3" /><img alt="验证码" src="../System/CheckCode.aspx"
                                    width="70px" />--%>
                            </td>
                        </tr>
                        <tr>
                            <td style="height: 14px">
                            </td>
                            <td>
                               <asp:Button ID="btnAction" Text="解密" class="button_100" runat="server" OnClick="btnAction_Click" />
                        <asp:Button ID="btnNext" Text="下一步" class="button_100" runat="server" OnClick="btnNext_Click" />
                                <asp:HiddenField ID="hddContainerName" runat="server" />
                                <asp:HiddenField ID="hddEncCert" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center">
                              
                            </td>
                        </tr>
                    </table>
                    
</asp:Content>
